package Homework.Three;

import java.io.*;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test5 {
    public static void main(String[] args) throws IOException {
        FileOutputStream file = new FileOutputStream("te.txt");
        OutputStreamWriter osw= new OutputStreamWriter(file, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter p = new PrintWriter(bw,true);
        Scanner scan = new Scanner(System.in);
        System.out.println("请输入：");
        while(true){
            String s = scan.next();
            if ("exit".equals(s)){
               break;
            }
            p.println(s);
            p.close();

        }

    }
}
